package com.lyb.spzx.manager.service.impl;

import com.lyb.spzx.manager.mapper.SysRoleUserMapper;
import com.lyb.spzx.manager.service.SysRoleUserService;
import com.lyb.spzx.model.dto.system.AssginRoleDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class SysRoleUserServiceImpl implements SysRoleUserService {

    @Autowired
    private SysRoleUserMapper sysRoleUserMapper;

    @Override
    public void doAssgin(AssginRoleDto assginRoleDto) {
        //添加前先删除该用户所配的角色
        sysRoleUserMapper.deleteUserById(assginRoleDto.getUserId());
        //
        sysRoleUserMapper.doAssgin(assginRoleDto.getUserId(),assginRoleDto.getRoleIdList());
    }
}
